Skip to content

Enable autoupdate #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jan 8, 2021
Merged

Enable autoupdate #582

merged 18 commits into from
Jan 8, 2021

Conversation

umbynos
Copy link
Contributor

@umbynos umbynos commented Dec 31, 2020

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • What kind of change does this PR introduce?

feature, CI

  • What is the current behavior?

auto-update is not enabled

  • What is the new behavior?

With this PR I will enable auto-update in the CI and I'll make some fixes in the auto-update related code

  • Does this PR introduce a breaking change?

no

  • Other information:

Comment on lines 34 to 41
- name: Identify Prerelease
# This is a workaround while waiting for create-release action to implement auto pre-release based on tag
id: prerelease
run: |
wget -q -P /tmp https://github.com/fsaintjacques/semver-tool/archive/3.1.0.zip
unzip -p /tmp/3.1.0.zip semver-tool-3.1.0/src/semver >/tmp/semver && chmod +x /tmp/semver
if [[ $(/tmp/semver get prerel ${GITHUB_REF/refs\/tags\//}) ]]; then echo "::set-output name=IS_PRE::true"; fi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step required because we do not want to push auto-update files in case of a pre-release

Comment on lines 115 to 117
- name: Create autoupdate files
run: ${GOPATH}/bin/go-selfupdate arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} # this will create `public/` dir with compressed full bin (<version>/<os>-<arch>.gz) and a json file
if: steps.prerelease.outputs.IS_PRE != 'true'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
The json file contains:

{
    "Version": "1.2.0",
    "Sha256": "rm8UXVGaGsh8KCVsG0JYBK9VoULaBu2zA/aVPuRf1Qo="
}

and public/1.2.0/linux-amd64.gz is the archive containing the full binary used for the updating

if: steps.prerelease.outputs.IS_PRE != 'true'

- name: Upload autoupdate files to Arduino downloads servers
run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} --include "*"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the upload target should be correct: env.TARGET = "/CreateBridge/", so the full path will be:
http://downloads.arduino.cc/CreateBridge/

So pushing all the files inside public should result in:
http://downloads.arduino.cc/CreateBridge/linux-amd64.json
http://downloads.arduino.cc/CreateBridge/1.2.0/linux-amd64.gz

@umbynos
Copy link
Contributor Author

umbynos commented Dec 31, 2020

Good news 🥳 :
The auto-update seems to be working from 1.1.251 to 1.2.0 (even if crashreport entry is not present inside config.ini)
Bad news 😢 :
Not working from 1.2.0-rc3 to 1.2.0 (maybe some regression was introduced in the middle. The downloaded binary seems to have problems starting. Some more 🔎 investigation is required.

This is what I did to test autoupdate:

  1. built 1.2.0 locally ⚙️
  2. run /home/umberto/go/bin/go-selfupdate arduino-create-agent 1.2.0 -> this creates public dir as explained here 📁
  3. used webserver example from here to locally host the update files ⬆️
  4. change config.ini accordingly: updateUrl = http://localhost:8080/
  5. send a POST to http://127.0.0.1:8991/update -> this triggers the auto-update mechanism

@umbynos umbynos self-assigned this Dec 31, 2020
@umbynos umbynos added the CI label Dec 31, 2020
@umbynos
Copy link
Contributor Author

umbynos commented Jan 4, 2021

Apparently, the problem comes from the fact that Arduino_Create_Agent-temp cannot copy itself to Arduino_Create_Agent. This behavior was introduced in #551

@umbynos
Copy link
Contributor Author

umbynos commented Jan 5, 2021

Fix incoming in #583

@umbynos umbynos force-pushed the umbynos/autoupdate branch from e98756e to 8a6dee8 Compare January 5, 2021 15:50
@umbynos umbynos force-pushed the umbynos/autoupdate branch 3 times, most recently from 49ffa0e to 60aefb8 Compare January 7, 2021 10:08
@umbynos umbynos force-pushed the umbynos/autoupdate branch from ea31785 to 46ae0a4 Compare January 7, 2021 14:28
@umbynos umbynos requested a review from zmoog January 8, 2021 14:33
Copy link
Contributor

@zmoog zmoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@umbynos umbynos merged commit 22552fb into devel Jan 8, 2021
@umbynos umbynos deleted the umbynos/autoupdate branch January 8, 2021 16:13
umbynos added a commit that referenced this pull request Jan 12, 2021
* add new error since DiffURL is not used (no patch bin) and optimize code

* add first implementation of auto-update to release workflow

* fix go-selfupdate not being found

* use globally bash (for win compatibility) and move comment

* uniform test.yml to release.yml
@per1234 per1234 added the topic: infrastructure Related to project infrastructure label Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants